﻿namespace Liphofra.Mvvm.ViewModels
{
    /// <summary>
    /// This is a convenience class that uses the same view model type for both the runtime and design-time view models.
    /// </summary>
    /// <typeparam name="TViewModel">The type of the view model to use both for the runtime and design-time view models.</typeparam>
    public class ViewModelLocatorBase<TViewModel> : ViewModelLocatorBase<TViewModel, TViewModel> where TViewModel : class
    {
        /// <summary>
        /// Gets the view model. Depending on whether the code is executed on runtime or design-time the corresponding view model is returned.
        /// </summary>
        public TViewModel ViewModel
        {
            get
            {
                return IsInDesignMode ? DesignTimeViewModel : RuntimeViewModel;
            }
        }
    }
}